﻿@if (User.Identity.IsAuthenticated) {
    <h2>Website Page Listing for: @User.Identity.Name</h2>
} else {
    <h2>Sample Website Page Listing</h2>
}
<div class="table-responsive">
    <table class="table table-condensed table-striped">
        <tr>
            <th>
                @Html.DisplayName("User Name")
            </th>
            <th>
                @Html.DisplayName("Website Name")
            </th>
            <th>
                @Html.DisplayName("Page URL")
            </th>
        </tr>

        @foreach (LynxWebLog.ViewModels.PageDataView item in ViewBag.ListPageDataView) {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.bd.username)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.bd.blogname)
                </td>
                <td>
                    <a href="@item.Url(Context.Request.RequestContext)">@item.Url(Context.Request.RequestContext)</a>
                </td>
            </tr>
        }

    </table>
</div>
@if (!User.Identity.IsAuthenticated) {
    @Html.ActionLink("Refresh Sample Website Pages List", "Index", "Home", null, new { @class = "btn btn-default btn-primary" })
} else {
    @Html.ActionLink("Add New Page", "Create", "PageEntry",
        routeValues: new { Area = "Pages", controller = "PageEntry", action = "Create", username = User.Identity.Name, blogname = LynxWebLog.CookieFacade.CurrentBlog }, 
        htmlAttributes: new { @class = "btn btn-default btn-primary" });
}


